<link rel="stylesheet" href="__CDN__/assets/addons/groupon/libs/element/element.css">
<link rel="stylesheet" href="__CDN__/assets/addons/groupon/libs/common.css">
<style>
    .order-table {
        padding: 20px 0 0;
        background: #fff;
        margin-top: 10px;
    }

    .order-table .el-table {
        color: #999;
        font-size: 12px;
    }

    /* 中间部分 */
    .order-table .el-table__row td {
        background: #F9F9F9 !important;
        height: 30px !important;
        padding: 0;
    }

    .order-table .el-table__expanded-cell[class*=cell] {
        padding: 0;
    }

    /* 多余的border */
    .order-table .el-table--border td,
    .order-table .el-table--border th,
    .order-table .el-table__body-wrapper .el-table--border.is-scrolling-left~.el-table__fixed {
        border-left: none;
        border-right: none;
    }

    .order-table .el-table--border {
        border-left: none;
    }

    .order-table .el-table::before,
    .el-table__fixed-right::before,
    .el-table__fixed::before {
        height: 0;
    }

    .order-table .el-table td,
    .order-table .el-table th.is-leaf {
        border-bottom: none;
    }
    .order-table .el-table__empty-block {
        border: 1px solid #e6e6e6;
    }
    .el-table_1_column_1 {
        border-left: 1px solid #e6e6e6 !important;
    }

    .el-table_1_column_9 {
        border-right: 1px solid #e6e6e6 !important;
    }

    .order-table .el-table td {
        padding: 0;
        border-top: 1px solid #E6E6E6;
    }

    .margin-right-10 {
        margin-right: 10px;
    }

    .expand-item-container {
        margin-bottom: 8px;
        color: #444;
        width: 100%;
        font-size: 13px;
    }

    .expand-item {
        /* height: 80px; */
        width: 104px;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .expand-item-item {
        height: 80px;
        border-bottom: 1px solid #E6E6E6;
        padding: 16px 14px 14px;
        width: 100%;
    }

    .expand-item-1 {
        width: 633px;
        border-left: 1px solid #E6E6E6;
        flex-direction: column;
    }

    .goods-image {
        width: 50px;
        height: 50px;
        margin-right: 14px;
    }

    .goods-title {
        margin-bottom: 12px;
        text-align: left;
    }

    .expand-item-2 {
        flex-direction: column;
    }

    .expand-item-3 {
        width: 94px;
    }

    .expand-item-5 {
        width: 114px;
        padding: 0 10px;
    }

    .expand-item-7 {
        width: 136px;
    }

    .expand-item-8 {
        flex: 1;
        min-width: 80px;
        text-align: center;
    }

    .pay-type {
        padding: 0 5px;
        border-radius: 4px;
        display: block;
        border: 1px solid #B698E7;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .pay-type-wallet {
        border-color: #B698E7;
        background: #E9E2F5;
        color: #8A44FC;
    }

    .pay-type-wechat {
        border-color: #A2E8C4;
        background: #E4F5EC;
        color: #4AD88E;
    }

    /* popover */
    .popover-item {
        height: 30px;
    }

    .popover-item-title {
        width: 50px;
        display: block;
    }

    .user-avatar {
        width: 26px;
        height: 26px;
        border-radius: 50%;
    }

    .user-id {
        border-bottom: 1px solid #7438D5;
        height: 24px;
        line-height: 24px;
        cursor: pointer;
        color: #7438D5;
    }

    .user-nickname {
        /* border-bottom: 1px solid #7438D5; */
        color: #7438D5;
        height: 30px;
        line-height: 30px;
        width: 80px;
        text-align: center;
    }

    .consignee-item {
        width: 80px;
        margin-bottom: 12px;
    }

    /* operation */
    .operation-container .el-dialog {
        width: 500px;
    }

    .operation-container .el-dialog__body {
        padding-top: 20px;
        padding-bottom: 20px;
    }

    .operation-container .el-table th {
        padding: 5px 0;
    }

    .operation-container .el-table .cell {
        justify-content: center;
    }

    .operation-container .el-table td,
    .operation-container .el-table th.is-leaf {
        border-bottom: 1px solid #e6e6e6;
    }

    .operation-container .el-table--border td,
    .operation-container .el-table--border th {
        border-right: none;
    }

    .package-container-header {
        justify-content: space-between;
        margin-bottom: 8px;
    }

    .package-container-item {
        padding: 16px 20px 0;
        background: #F9F9F9;
        border: 1px solid #E6E6E6;
        border-radius: 4px;
    }

    .package-item-container {
        margin-bottom: 16px;
    }

    .package-item-container-header {
        font-weight: 500;
        font-size: 14px;
        line-height: 14px;
        margin-bottom: 12px;

        color: #333333;
    }

    .package-item-container-tip {
        font-size: 12px;
        line-height: 12px;
        margin-bottom: 12px;
        color: #333333;
    }

    .package-item-container-tip:last-child {
        margin-bottom: 0;
    }

    .package-item-delivery {
        height: 82px;
        padding-left: 172px;
        overflow-y: auto;
    }

    .package-item-delivery::-webkit-scrollbar {
        width: 6px;
    }

    .package-item-delivery::-webkit-scrollbar-thumb {
        width: 6px;
        background: #ccc;
        height: 20px;
        border-radius: 3px;
    }

    #detailPage {
        background: #fff;
        padding: 10px 20px 0;
    }

    .log-tip {
        font-size: 26px;
        color: #ccc;
        margin-left: 20px;
    }

    .dashboardlist-container {
        margin: 24px 0 0;
    }

    .dashboardlist-item-container {
        background: #FFFFFF;
        border: 1px solid #E6E6E6;
        border-radius: 6px;
        padding: 16px;
        margin-bottom: 20px;
    }

    .dashboardlist-image {
        width: 70px;
        height: 70px;
        background: #BF9898;
        border-radius: 4px;
        margin-right: 12px;
        flex-shrink: 0;
    }

    .dashboardlist-message {
        height: 70px;
        flex: 1;
        flex-direction: column;
        justify-content: space-between;
        align-items: flex-start;
        font-size: 14px;
        color: #444;
    }

    .dashboardlist-sku {
        justify-content: space-between;
        width: 100%;
    }

    .goods-num {
        color: #333;
        font-weight: 600;
    }

    .el-image {
        width: 100%;
        height: 100%;
    }

    .image-slot {
        display: flex;
        justify-content: center;
        align-items: center;
        height: 100%;
    }

    .el-step__icon {
        width: 10px;
        height: 10px;
        background: #7438D5;
        border-radius: 50%;
    }

    .is-wait .el-step__icon {
        background: #ccc;
    }

    .el-step__title,
    .el-step__title {
        font-weight: 500 !important;
        font-size: 14px !important;
        color: #333;
    }

    .el-step__title {
        position: absolute;
        left: -142px;
    }

    .el-step__icon-inner {
        display: none;
    }

    .el-step.is-vertical .el-step__line {
        width: 2px;
        top: 2px;
        bottom: 0;
        left: 4px;
    }

    .el-step__description {
        min-height: 40px;
        margin: 0px 0 10px;
        line-height: 20px;
    }

    .el-step__title.is-process {
        color: #666;
    }

    .el-step.is-vertical .el-step__title {
        line-height: 18px;
    }

    .ellipsis-item-2 {
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    [v-cloak] {
        display: none
    }
</style>
<script src="__CDN__/assets/addons/groupon/libs/vue.js"></script>
<script src="__CDN__/assets/addons/groupon/libs/element/element.js"></script>
<script src="__CDN__/assets/addons/groupon/libs/moment.js"></script>
<div id="detailPage" v-cloak v-loading="isAjax">
    <div class="package-container" v-loading="packageAjax">
        <div class="package-container-header display-flex">
            <div class="common-refresh-button">
                <i class="el-icon-refresh" @click="operation('search')"></i>
            </div>
            <div class="display-flex">
                <el-button @click="operation('subscribe')" size="small">重新订阅</el-button>
                <div class="log-tip">
                    <el-popover placement="bottom-end" title="" width="200" trigger="hover"
                        content="如果长时间物流状态没有更新，可以尝试刷新一下。如果没有物流信息，可以尝试重新订阅一下！">
                        <i class="el-icon-question" slot="reference"></i>
                    </el-popover>
                </div>
            </div>
        </div>
        <div class="package-container-item">
            <el-row>
                <el-col :xs="24" :sm="16" :md="16" :lg="8" :xl="8">
                    <div class="package-item-container">
                        <div class="package-item-container-header">自提点信息</div>
                        <div class="package-item-container-tip">
                            <span>自提点名称：</span><span>{{storeForm.name?storeForm.name:'-'}}</span></div>
                        <div class="package-item-container-tip">
                            <span>收货人：</span><span>{{storeForm.realname?storeForm.realname:'-'}}</span>
                        </div>
                        <div class="package-item-container-tip">
                            <span>联系电话：</span><span>{{storeForm.phone?storeForm.phone:'-'}}</span></div>
                        <div class="package-item-container-tip">
                            <span>收货地址：</span><span
                                v-if='storeForm.province_name'>{{storeForm.province_name}}{{storeForm.city_name}}{{storeForm.area_name}}{{storeForm.address}}</span>
                            <span v-if='!storeForm.province_name'>-</span>
                        </div>
                    </div>
                </el-col>
                <el-col :xs="24" :sm="8" :md="8" :lg="4" :xl="4">
                    <div class="package-item-container">
                        <div class="package-item-container-header">物流信息</div>
                        <div class="package-item-container-tip">
                            <span>物流公司：</span><span>{{deliverForm.express_name?deliverForm.express_name:'-'}}</span>
                        </div>
                        <div class="package-item-container-tip">
                            <span>物流单号：</span><span>{{deliverForm.express_no?deliverForm.express_no:'-'}}</span>
                        </div>
                        <div class="package-item-container-tip">
                            <span>发货时间：</span>
                            <span>{{moment(deliverForm.updatetime*1000).format('YYYY-MM-DD HH:mm:ss')}}</span>
                        </div>
                    </div>
                </el-col>
                <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
                    <div class="package-item-container">
                        <div class="package-item-container-header">物流状态:<span
                                v-if="packageLog && packageLog[0]">{{packageLog[0].status_name}}</span></div>
                        <div class="package-item-delivery">
                            <el-steps direction="vertical" :active="packageActive">
                                <el-step v-for="i in packageLog" :title="i.changedate" :description="i.content">
                                </el-step>
                            </el-steps>
                        </div>
                    </div>
                </el-col>
            </el-row>
        </div>
    </div>
    <div class="dashboardlist-container">
        <el-row :gutter="20">
            <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="6" v-for="dash in dashboardList">
                <div class="dashboardlist-item-container display-flex">
                    <div class="dashboardlist-image">
                        <el-image :src="Fast.api.cdnurl(dash.goods_image)" fit="cover">
                            <div slot="error" class="image-slot">
                                <i class="el-icon-picture-outline"></i>
                            </div>
                        </el-image>
                    </div>
                    <div class="dashboardlist-message display-flex">
                        <div class="ellipsis-item-2">{{dash.goods_title}}</div>
                        <div class="display-flex dashboardlist-sku">
                            <div v-if="dash.goods_sku_text" class="goods-sku">规格：{{dash.goods_sku_text}}</div>
                            <div class="goods-num">数量：{{dash.goods_num}}件</div>
                        </div>
                    </div>
                </div>
            </el-col>
        </el-row>
    </div>
    <div class="order-table background-white color-666">
        <el-table :data="orderList" border default-expand-all="true">
            <el-table-column type="expand">
                <template slot-scope="props">
                    <div class="expand-item-container display-flex">
                        <div class="expand-item expand-item-1 border-right">
                            <div class="expand-item-item display-flex" v-for="(item,index) in props.row.item">
                                <div class="goods-image" v-if="item.goods_image">
                                    <el-image :src="Fast.api.cdnurl(item.goods_image)" fit="cover">
                                        <div slot="error" class="image-slot">
                                            <i class="el-icon-picture-outline"></i>
                                        </div>
                                    </el-image>
                                </div>
                                <div>
                                    <div class="goods-title ellipsis-item">{{item.goods_title}}</div>
                                    <div class="color-999 display-flex">
                                        <span class="margin-right-10" v-if="item.goods_sku_text">规格：{{item.goods_sku_text}}</span>
                                        <span class="margin-right-10">单价：{{item.goods_price}}元</span>
                                        <span>数量：{{item.goods_num}}</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="expand-item expand-item-2 border-right">
                            <div class="expand-item-item display-flex-c" v-for="(item,index) in props.row.item">
                                <span v-if="props.row.status>0">{{item.status_name}}</span>
                                <span v-if="props.row.status<=0">-</span>
                            </div>
                        </div>
                        <div class="expand-item expand-item-3 border-bottom border-right"
                            :style="{'height': props.row.item.length*80+'px'}">
                            <span :class="props.row.status<0?'color-999':'color-444'">
                                {{props.row.status_text}}
                            </span>
                        </div>
                        <div class="expand-item expand-item-4 border-bottom border-right"
                            :style="{'height': props.row.item.length*80+'px'}">
                            <template v-if="props.row.user">
                                <el-popover placement="bottom" width="200" height="80" trigger="hover">
                                    <div class="popover-container">
                                        <div class="popover-item display-flex">
                                            <span class="popover-item-title">头像</span><span>:</span>
                                            <img class="user-avatar margin-left-10"
                                                :src="Fast.api.cdnurl(props.row.user.avatar)">
                                        </div>
                                        <div class="popover-item display-flex">
                                            <span class="popover-item-title">ID</span><span>:</span>
                                            <span class="user-id margin-left-10"
                                                @click="goOrderUser(props.row.user.id)">
                                                {{props.row.user?props.row.user.id:''}}
                                            </span>
                                        </div>
                                        <div v-if="props.row.user.mobile" class="popover-item display-flex">
                                            <span class="popover-item-title">手机号</span><span>:</span>
                                            <span class="margin-left-10">{{props.row.user.mobile}}</span>
                                        </div>
                                    </div>
                                    <div slot="reference">
                                        <div class="user-nickname color-666 ellipsis-item"
                                            v-if="props.row.user.nickname" @click="goOrderUser(props.row.user.id)">
                                            {{props.row.user.nickname}}
                                        </div>
                                        <div class="user-nickname color-666 ellipsis-item" v-else
                                            @click="goOrderUser(props.row.user.id)">
                                            无昵称
                                        </div>
                                    </div>
                                </el-popover>
                            </template>
                            <span v-else>{{props.row.user_id}}</span>
                        </div>
                        <div class="expand-item expand-item-5 border-bottom border-right"
                            :style="{'height': props.row.item.length*80+'px'}">
                            <div class="ellipsis-item" v-if="props.row.store">{{props.row.store.name}}</div>
                            <span v-else>{{props.row.store_id}}</span>
                        </div>
                        <div class="expand-item expand-item-6 border-bottom border-right"
                            :style="{'height': props.row.item.length*80+'px'}">
                            <div v-if="props.row.consignee">
                                <div class="consignee-item color-666 ellipsis-1">
                                    {{props.row.consignee}}
                                </div>
                                <div class="color-666">{{props.row.phone}}</div>
                            </div>
                            <div v-if="!props.row.consignee">-</div>
                        </div>
                        <div class="expand-item expand-item-7 border-bottom border-right"
                            :style="{'height': props.row.item.length*80+'px'}" style="width: 136px;">
                            <span>{{props.row.pay_fee}}<span class="common-unit">元</span></span>
                        </div>
                        <div class="expand-item expand-item-8 border-bottom border-right"
                            :style="{'height': props.row.item.length*80+'px'}">
                            <span class="theme-color cursor-pointer" @click.stop="goDetail(props.row.id)">
                                查看详情
                            </span>
                        </div>
                    </div>
                </template>
            </el-table-column>
            <el-table-column width="585" label="商品信息">
                <template slot-scope="scope">
                    <div class="display-flex">
                        <span class="margin-right-10 color-444">ID:{{scope.row.id}}</span>
                        <span class="margin-right-10">
                            订单号:{{scope.row.order_sn}}
                            <span v-if="scope.row.createtime">
                                下单时间:{{moment(scope.row.createtime*1000).format('YYYY-MM-DD HH:mm:ss')}}
                            </span>
                        </span>
                    </div>
                </template>
            </el-table-column>
            <el-table-column width="104" label="发货状态" align="center">
                <template slot-scope="scope">
                    <span v-if="scope.row.pay_type=='wallet'"
                        class="pay-type pay-type-wallet">{{scope.row.pay_type_text}}</span>
                    <span v-if="scope.row.pay_type=='wechat'"
                        class="pay-type pay-type-wechat">{{scope.row.pay_type_text}}</span>
                </template>
            </el-table-column>
            <el-table-column width="94" label="订单状态" align="center">
            </el-table-column>
            <el-table-column width="104" label="下单用户" align="center">
            </el-table-column>
            <el-table-column width="114" label="所属自提点" align="center">
            </el-table-column>
            <el-table-column width="104" label="取货信息" align="center">
            </el-table-column>
            <el-table-column width="136" label="支付金额(元)" align="center">
            </el-table-column>
            <el-table-column fixed="right" label="操作" align="center">
                <template slot-scope="scope">
                    <div class="theme-color cursor-pointer" @click="optRecord(scope.row.id)">操作日志</div>
                </template>
            </el-table-column>
        </el-table>
    </div>
    <div class="operation-container">
        <el-dialog title="操作日志" :visible.sync="optRecordDialog">
            <el-table :data="optList" border>
                <el-table-column property="remark" label="事件">
                    <template slot-scope="scope">
                        <div class="ellipsis-item">{{scope.row.remark}}</div>
                    </template>
                </el-table-column>
                <el-table-column property="oper.name" label="员工" width="100"></el-table-column>
                <el-table-column property="createtime" width="200" label="时间">
                    <template slot-scope="scope">
                        <span>{{moment(scope.row.createtime*1000).format("YYYY-MM-DD HH:mm:ss")}}</span>
                    </template>
                </el-table-column>
            </el-table>
        </el-dialog>
    </div>
</div>